package com.ds.impl;

import com.ds.api.IOrderDeclaraService;
import com.ds.base.msg.OrderDeclaraMsg;
import com.ds.persist.OrderDeclara;
import com.value.mybatis.DaoRouter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrderDeclaraService implements IOrderDeclaraService {

    @Override
    public void doOrderDeclara(OrderDeclaraMsg orderInfo) {
        daoRouter.insert("OrderDeclara.insertOrderDeclara",orderInfo);
        orderInfo.setOrderId(orderInfo.getId());
        orderInfo.getCargoes().get(0).setOrderId(orderInfo.getId());
        daoRouter.insert("OrderDeclaraCargo.insertOrderDeclaraCargo",orderInfo.getCargoes().get(0));
        daoRouter.insert("OrderDeclaraPayinfo.insertOrderDeclaraPayinfo",orderInfo);
        daoRouter.insert("OrderDeclaraRec.insertOrderDeclaraRec",orderInfo);
        daoRouter.insert("OrderDeclaraSender.insertOrderDeclaraSender",orderInfo);
    }

    @Override
    public void doOrderDeclaraCancel(OrderDeclara orderInfo) {

    }

    @Autowired
    private DaoRouter daoRouter;
}
